<template>
    <div class="hello">
        <x-header>添加比赛</x-header>
        <div style="position: absolute;width: 100%;">
            <group title="羽毛球比赛">
                <x-input v-model="province" title="province" placeholder=""></x-input>
                <x-input v-model="city" title="city"  placeholder=""></x-input>
                <x-input v-model="address" title="address"  placeholder=""></x-input>
                <x-input v-model="gym" title="gym"  placeholder=""></x-input>
                <x-input v-model="latitude" title="latitude" placeholder=""></x-input>
                <x-input v-model="longitude" title="longitude"  placeholder=""></x-input>
                <x-input v-model="pk_time" title="pk_time"  placeholder=""></x-input>
            </group>
            <div style="position: fixed; top: auto; bottom: 40px; left: 10%;right: 10%">
                <x-button type="primary" :disabled="disable001" @click.native="processButton001">提交</x-button>
            </div>
        </div>
    </div>
</template>

<script>
    import { Group, Cell, Tabbar, TabbarItem, Swiper, SwiperItem } from '_vux@2.9.3@vux'
    import {api} from '@/api'
    import {os} from '@/hos/os'

    export default {
        components: {
            Group,
            Cell,
            Tabbar,
            TabbarItem,
            Swiper,
            SwiperItem
        },
        name: 'BadmintonPkAdd',
        data () {
            return {
                province: '广东',
                city: '广州',
                latitude: 0,
                longitude: 0,
                address: '',
                gym: '鸣翠花园',
                pk_time: os.time() + 60 * 60 * 24 /* 一天后 */
            }
        },
        methods: {
            processButton001 () {
                // 创建群,经纬度使用BD09坐标系
                let request = {
                    province: this.province, // 行政区域
                    city: this.city, // 城市
                    latitude: this.latitude,
                    longitude: this.longitude,
                    address: this.address, // 详细地址
                    gym: this.gym, // 球馆
                    pk_time: this.pk_time // 比赛时间（时间戳/浮点数/单位秒）
                }
                api.post('Badminton/groupCreate', request, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            }
        },
        beforeDestroy () {
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
    h1, h2 {
        font-weight: normal;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        display: inline-block;
        margin: 0 10px;
    }
    a {
        color: #42b983;
    }
</style>
